package com.yyp.car.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yyp.car.Iservice.ISchoolService;
import com.yyp.car.model.School;

@Controller
@RequestMapping("/school")
public class SchoolController {
	@Resource(name="schoolService")
	private ISchoolService schoolService;
	
	@RequestMapping("/addSchool")
	public String addSchool(School school){
		schoolService.addSchool(school);
		return "redirect:/back/schoolManager";
	}
	
	@RequestMapping("/updateSchool")
	public String updateSchool(School school){
		schoolService.updateSchool(school); 
		return "redirect:/back/schoolManager";
	}
	
	@RequestMapping("/deleteSchool/{id}")
	public String deleteSchool(@PathVariable int id){
		schoolService.delete(id);
		return "redirect:/back/schoolManager";
	}

}
